<?php
defined('BASEPATH') OR exit('No direct script access allowed');
class Relationship extends CI_Controller {




    function __construct(){
        parent::__construct();
        $this->load->model('RelationshipModel','re'); //加载model模型类
    }

    function index(){
        $proInfo = $this->re->getProInfo(); //获取数据
        $data = array();
        foreach ($proInfo as $k=>$info){
            $data['product'][$k] = (array)($info);
        }
//        print_r($data);
//        die();
        $this->load->View('relationship/relationship.html',$data); //传递数据到view中
    }


    public function delete(){
          $id=$this->input->get();
          $delete=$this->db->delete('contect',array('id'=>$id['id']));
        if($delete)
        {
            echo "<script type='text/javascript'> alert('删除成功'); location.href = '/index.php/relationship/index';</script>";

      }else{
            echo "<script type='text/javascript'> alert('删除失败'); location.href = '/index.php/relationship/index';</script>";
        }


    }



}